package cn.brilliantfuture.commentry.entity;

// Generated 2011-11-3 13:34:34 by Hibernate Tools 3.3.0.GA

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * Location generated by hbm2java
 */
@Entity
@Table(name = "location", catalog = "cabinet")
public class Location implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Integer locationId;
	private Villiage villiage;
	private String name;
	private String description;
	private Integer insertUser;
	private Date insertTime;
	private boolean deleted;
	private String enName;
	private Set<Lockers> lockerses = new HashSet<Lockers>(0);

	public Location() {
	}

	public Location(Villiage villiage, String name, boolean deleted, String enName) {
		this.villiage = villiage;
		this.name = name;
		this.deleted = deleted;
		this.enName = enName;
	}

	public Location(Villiage villiage, String name, String description,
			Integer insertUser, Date insertTime, boolean deleted, String enName,Set<Lockers> lockerses) {
		this.villiage = villiage;
		this.name = name;
		this.description = description;
		this.insertUser = insertUser;
		this.insertTime = insertTime;
		this.deleted = deleted;
		this.enName = enName;
		this.lockerses = lockerses;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "location_id", unique = true, nullable = false)
	public Integer getLocationId() {
		return this.locationId;
	}

	public void setLocationId(Integer locationId) {
		this.locationId = locationId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "villiage_id", nullable = false)
	@NotNull
	public Villiage getVilliage() {
		return this.villiage;
	}

	public void setVilliage(Villiage villiage) {
		this.villiage = villiage;
	}

	@Column(name = "name", nullable = false, length = 45)
	@NotNull
	@Length(max = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "description", length = 200)
	@Length(max = 200)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "insert_user")
	public Integer getInsertUser() {
		return this.insertUser;
	}

	public void setInsertUser(Integer insertUser) {
		this.insertUser = insertUser;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "insert_time", length = 19)
	public Date getInsertTime() {
		return this.insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}

	@Column(name = "deleted", nullable = false)
	public boolean isDeleted() {
		return this.deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	@Column(name = "en_name", nullable = false, length = 100)
	@NotNull
	@Length(max = 100)
	public String getEnName() {
		return this.enName;
	}

	public void setEnName(String enName) {
		this.enName = enName;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "location")
	public Set<Lockers> getLockerses() {
		return this.lockerses;
	}

	public void setLockerses(Set<Lockers> lockerses) {
		this.lockerses = lockerses;
	}

}
